﻿using System;
using System.Windows.Forms;

namespace WindowsAPI
{
    public sealed partial class KeyShortCutViewer : Form
    {
        public string ShortCut
        {
            get { return Value_TextBox.Text; }
            set { Value_TextBox.Text = value; }
        }

        public KeyShortCutViewer() { InitializeComponent(); }

        public KeyShortCutViewer(KeyboardComponent Keyboard)
        {
            InitializeComponent();

            Keyboard.KeyDown += OnKeyDown;
        }

        public void OnKeyDown(KeyboardComponent Sender, OnKeyboardEventArgs Args)
        {
            Value_TextBox.Text = Sender.PressedKeys.ToString();
        }

        private void Cancel_Button_Click(object sender, EventArgs e)
        {
            Close();
            DialogResult = DialogResult.Cancel;
        }

        private void Ok_Button_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }
    }
}
